Last updated: 2020-11-23

Checks: 7 0

Knit directory: Supplemenetary_data_files_automation/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20201119) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 9cfc372. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/about.Rmd) and HTML (docs/about.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 9cfc372 ArmanAttaran 2020-11-23 fixed the table of content to be numbered and show depth and float better. really big improvement and should be copied to all other analysis
html 983acf3 ArmanAttaran 2020-11-23 Build site.
html 9760eb4 ArmanAttaran 2020-11-23 Build site.
html 14991f0 ArmanAttaran 2020-11-23 Build site.
html da479c2 ArmanAttaran 2020-11-23 Build site.
html dbc184d ArmanAttaran 2020-11-23 Build site.
Rmd c47d751 ArmanAttaran 2020-11-23 Publish the initial files for myproject
html 476137e ArmanAttaran 2020-11-20 wflow_git_commit(all = TRUE)
Rmd 3cab4d1 ArmanAttaran 2020-11-20 added table of content
Rmd 6694504 ArmanAttaran 2020-11-20 adding the progress from net a
Rmd 4ab77e3 ArmanAttaran 2020-11-19 copied in some stuff from the past attempt
html 0330455 armanattaran 2020-11-19 Build site.
html cb14b5e ArmanAttaran 2020-11-19 Build site.
html a1e5710 ArmanAttaran 2020-11-19 Build site.
html f085ca6 ArmanAttaran 2020-11-19 Build site.
html a3412ef ArmanAttaran 2020-11-19 Build site.
Rmd 943fa43 ArmanAttaran 2020-11-19 Start workflowr project.

``

1 introduction

this is a base project to simply show creating the supplementary data files and show casing how this simple concept can be used to create maintainable that is easily extendable and has the tools required to manage complexity.

to understand this document browse it as if you would any website; exploring is important and baked into it

1.1 my musings on managing complexity

anyone can write code a computer can understand; the real challenge is writing in a way that humans can

when a field becomes sufficiently advanced it reinvents algebra; so lets skip straight to algebra

we write software/code to manage complexities; without these tools it would be impossible to do much of all we do; but at the end of the day it is just a tool and picking the right tool for the job is important. when the only tool you have is a hammer everything looks like a nail below I will outline some tools that will help us manage the complexities of working in PGDP; especially remotely.

1.1.1 Tool #1 Rmarkdown

this document you are reading is a rmarkdown; it is magic as far as I am concerned it combines some powerful yet simple ideas but it ultimately allows you to communicate your purpose; documentation , logic , and code, work report, management tool, training document, research paper, data product, visualization tool, presentation material, panflet and hand out generator, report tool and many other uses in one manageable place; seriously just watch this. it is truly a marvel. more on literate programming here for more info but the jist is this

Literate programming is a programming paradigm introduced by Donald Knuth in which a computer program is given an explanation of its logic in a natural language, such as English, interspersed with snippets of macros and traditional source code, from which compilable source code can be generated.[1] The approach is used in scientific computing and in data science routinely for reproducible research and open access purposes.[2] Literate programming tools are used by millions of programmers today

rmarkdown gives you headings that collapse to further structure this, allowing you to jump between section very quickly

1.1.1.1 showing off what it can do in a static website

this here is a piece of code using a package called ggplot2; the data is from the world bank and is called gapminder it is a simple data set on life expectancy and gdp per country.

ggplot uses a grammar for describing visual components

library(ggplot2)
data(gapminder, package = "gapminder")
gg <- ggplot(gapminder, aes(gdpPercap, lifeExp, color = continent)) +
  geom_point(aes(size = pop, frame = year, ids = country)) +
  scale_x_log10()
Warning: Ignoring unknown aesthetics: frame, ids
plotly::ggplotly(gg)

1.1.1.2 adjusting the example above for our section

library(ggplot2)
library(tidyverse)
-- Attaching packages --------------------------------------- tidyverse 1.3.0 --
v tibble  3.0.3     v dplyr   1.0.2
v tidyr   1.1.2     v stringr 1.4.0
v readr   1.4.0     v forcats 0.5.0
v purrr   0.3.4     
-- Conflicts ------------------------------------------ tidyverse_conflicts() --
x dplyr::filter() masks stats::filter()
x dplyr::lag()    masks stats::lag()
pgdp <- cansim::get_cansim( "36-10-0402-02") %>% select(REF_DATE,GEO,Value,VALUE,`North American Industry Classification System (NAICS)`) %>% pivot_wider(names_from = Value, values_from = VALUE) 
Accessing CANSIM NDM product 36-10-0402 from Statistics Canada
Parsing data
Folding in metadata
#
gg <- ggplot(pgdp, aes(`Contributions to percent change`, `Current dollars`, color = GEO)) +
  geom_point(aes(size = `Chained (2012) dollars`, frame = REF_DATE, ids = `North American Industry Classification System (NAICS)`)) +
  scale_x_log10()
Warning: Ignoring unknown aesthetics: frame, ids
plotly::ggplotly(gg)
Warning in self$trans$transform(x): NaNs produced
Warning: Transformation introduced infinite values in continuous x-axis

use string matching to only 2 digit naics and manufacturing and bring in MSM data

1.2 Tool #2 git

git allows us to effectively track what we have worked on and go back if we need to; it also helps us keep track of versions and also enables to work collaboratively in a tractable and manageable way. scroll to the and click on the black box workflowr past versions; there you can see track all that I have done to this page.

2 technical notes

2.1 tools used

this project uses workflowr, gitand rmarkdown to ensure reproducibility; documentation and version history. alternatively it can be hosted on github or gitlab(on net a)

2.2

Describe your project. hell oworld

Notes on R

3 ## R libraries

R libraries are similar to SAS procs for example proc SQL roughly translates to the library dplyr in R

before we start working in R we need to install necessary R libraries and call them and set our working directory.

package installation is commented out since we do only need to install the libraries once

4


sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252   
[3] LC_MONETARY=English_Canada.1252 LC_NUMERIC=C                   
[5] LC_TIME=English_Canada.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] forcats_0.5.0   stringr_1.4.0   dplyr_1.0.2     purrr_0.3.4    
 [5] readr_1.4.0     tidyr_1.1.2     tibble_3.0.3    tidyverse_1.3.0
 [9] ggplot2_3.3.2   workflowr_1.6.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5        lubridate_1.7.9   ps_1.4.0          assertthat_0.2.1 
 [5] rprojroot_1.3-2   digest_0.6.25     R6_2.4.1          cellranger_1.1.0 
 [9] backports_1.1.10  reprex_0.3.0      evaluate_0.14     httr_1.4.2       
[13] pillar_1.4.6      rlang_0.4.7       curl_4.3          lazyeval_0.2.2   
[17] readxl_1.3.1      rstudioapi_0.11   data.table_1.13.2 whisker_0.4      
[21] blob_1.2.1        rmarkdown_2.5     labeling_0.4.2    htmlwidgets_1.5.2
[25] munsell_0.5.0     broom_0.7.2       compiler_4.0.3    httpuv_1.5.4     
[29] modelr_0.1.8      xfun_0.18         pkgconfig_2.0.3   htmltools_0.5.0  
[33] tidyselect_1.1.0  fansi_0.4.1       viridisLite_0.3.0 crayon_1.3.4     
[37] dbplyr_1.4.4      withr_2.3.0       later_1.1.0.1     grid_4.0.3       
[41] cansim_0.3.5      jsonlite_1.7.1    gtable_0.3.0      lifecycle_0.2.0  
[45] DBI_1.1.0         git2r_0.27.1      magrittr_1.5      scales_1.1.1     
[49] cli_2.1.0         stringi_1.5.3     farver_2.0.3      fs_1.5.0         
[53] promises_1.1.1    xml2_1.3.2        ellipsis_0.3.1    generics_0.0.2   
[57] vctrs_0.3.4       tools_4.0.3       glue_1.4.2        hms_0.5.3        
[61] crosstalk_1.1.0.1 yaml_2.2.1        colorspace_1.4-1  rvest_0.3.6      
[65] plotly_4.9.2.1    knitr_1.30        haven_2.3.1